#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main(int argc, char* argv[])
{   
    pid_t pid = 0;
    int var = 88;
    
    printf("parent = %d\n", getpid());
    
    if ((pid = vfork()) < 0) {
        printf("vfork error\n");
    } else if (pid == 0) {
        printf("pid = %d, var = %d\n", getpid(), var);
        var++;
        printf("pid = %d, var = %d\n", getpid(), var);
        
        _exit(0);
        // return 0; /* destroy parent stack frame */
    }

    printf("pid = %d, var = %d\n", getpid(), var);

    return 0;
}
